const Koa = require('koa');
const KoaBody = require('koa-body');
const Cros = require('@koa/cors');
const fs = require('fs');
const app = new Koa();
// console.log(Koa);
app.use(KoaBody({multipart: true}));
app.use(Cros());
app.use(async ctx => {
  console.log(ctx.request.files)
  var d = fs.writeFileSync('./', ctx.request.files[0], {encoding: 'utf-8'});
  console.log(d);
  ctx.body = 'hello';
})
app.listen(8080);